package com.hyjx.framework.component.mutidatasource.datasources;

import com.hyjx.framework.orm.BaseService;
import com.hyjx.framework.orm.dao.IBaseDao;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * 多数据源serviceImpl
 */
@Service
@Transactional
public class DataSourcesServiceImpl extends BaseService implements DataSourcesService {
    @Resource
    private IBaseDao dao;
    
    /**
     * 添加数据源
     */
    public boolean addDs(DataSourcesModel model) {
        return dao.addObject("datasources.insert", model);
    }
    
    /**
     * 删除某个数据源
     */
    public int deleteDs(DataSourcesModel model) {
        return dao.deleteObject("datasources.delete", model);
    }
    
    /**
     * 修改某个数据源
     */
    public int updateCondition(DataSourcesModel model) {
        
        return dao.updateObject("datasources.update", model);
    }
    
    /**
     * 查询符合条件的的数据源（包括所有的）
     */
    public List serviceAllDs(DataSourcesModel model) {
        return dao.queryObjectList("datasources.queryList", model);
    }
}
